{% extends 'task_market/base.html' %}
{% load static %}


{% block title %}
    任务详情-数据标注者
{% endblock %}

{% block content %}

    <div class="breadcrumbs">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="bread-inner">
                        <ul class="bread-list">
                            <li><a href="{% url 'task_market:index' %}" target="_blank">主页<i
                                    class="ti-arrow-right"></i></a></li>
                            <li><a href="{% url 'task_market:all_grid' %}" target="_blank">全部任务<i
                                    class="ti-arrow-right"></i></a></li>
                            <li class="active"><a href="#">任务详细信息</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="container mt-4 mx-auto">
        <div class="row">
            <div class="col-lg-12">
                <div class="account-content">
                    <h4 class="account-content-title"><i class="far fa-user"></i> 任务信息({{ task_details.task_name }})</h4>
                    <div class="profile-info">
                        <div class="row">
                            <div class="col-lg-7 mx-auto">
                                <div class="row">
                                    <div class="col-lg-4 mb-1">
                                        <div class="profile-widget">
                                            <b>{{ all_assign_num }}</b>
                                            <p>任务内容总计</p>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 mb-1">
                                        <div class="profile-widget">
                                            <b>{{ anno_assign_num }}</b>
                                            <p>已标注数量统计</p>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 mb-1">
                                        <div class="profile-widget">
                                            <b>{{ perc_anno }}</b>
                                            <p>完成进度</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="profile-details">
                        <div class="row">
                            <div class="col-lg-1 mx-auto">
                                <p>任务ID</p>
                                <h6>{{ task_details.id }}</h6>
                            </div>
                            <div class="col-lg-1 mx-auto">
                                <p>发布者ID</p>
                                <h6>{{ task_details.task_publish_id|truncatechars:8 }}</h6>
                            </div>
                            <div class="col-lg-1 mx-auto">
                                <p>任务类型</p>
                                {% if task_details.task_type == '1' %}
                                    <h6>文本分类</h6>
                                {% elif task_details.task_type == '4' %}
                                    <h6>图像分类</h6>
                                {% elif task_details.task_type == '5' %}
                                    <h6>图像标选</h6>
                                {% endif %}
                            </div>
                            <div class="col-lg-3 mx-auto">
                                <p>任务描述</p>
                                <h6>{{ task_details.task_description }}</h6>
                            </div>
                            <div class="col-lg-1 mx-auto">
                                <p>任务等级</p>
                                <h6>{{ task_details.task_rank }}</h6>
                            </div>
                            <div class="col-lg-1 mx-auto">
                                <p>申请</p>
                                <h6><a href="{% url 'task_market:task_apply' task_id=task_details.id %}"
                                       class="content-action content-action-mr"><i
                                        class="far fa-pen"> 申请</i></a></h6>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <section class="mt-4">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 mx-auto">
                    <div class="account-content">
                        <h4 class="account-content-title"><i class="far fa-shopping-bag"></i> 任务详情
                            ({{ task_details.task_name }})</h4>
                        <div class="account-content-table">
                            <div class="table-responsive">
                                <table class="table table-borderless">
                                    <tr>
                                        <th>内容编号</th>
                                        <th>内容信息</th>
                                        <th>内容状态</th>
                                    </tr>
                                    {% for content in content_details %}
                                        {% if task_details.task_type == '1' %}
                                            <tr class="account-order-list order-single-product">
                                                <td>
                                                    <div class="product-info">{{ content.taskdata_id|truncatechars:8 }}</div>
                                                </td>
                                                <td>
                                                    <div class="product-info">{{ content.taskdata_content }}</div>
                                                </td>
                                                <td>
                                                    {% if content.taskdata_status == '0' %}
                                                        <div class="product-info badge bg-secondary">未标注</div>
                                                    {% elif content.taskdata_status == '1' %}
                                                        <div class="product-info badge bg-success">已标注</div>
                                                    {% endif %}
                                                </td>
                                            </tr>
                                        {% elif task_details.task_type == '4' or task_details.task_type == '5' %}
                                            <tr class="account-order-list order-single-product">
                                                <td>
                                                    <div class="product-info">{{ content.taskdata_id }}</div>
                                                </td>
                                                <td>
                                                    <div class="product-info"><img
                                                            src="/images/{{ content.taskdata_content }}"
                                                            width="60"></div>
                                                </td>
                                                <td>
                                                    {% if content.taskdata_status == '0' %}
                                                        <div class="product-info badge bg-secondary">未标注</div>
                                                    {% elif content.taskdata_status == '1' %}
                                                        <div class="product-info badge bg-success">已标注</div>
                                                    {% endif %}
                                                </td>
                                            </tr>
                                        {% endif %}
                                    {% endfor %}
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <div style="margin-top: 20px;"></div>

{% endblock %}